using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using DotNetNuke.Modules.IWeb;
using DotNetNuke.Entities.Modules;

namespace DotNetNuke.Modules.IWeb
{
    public partial class WebServiceRoot 
    {

    [WebMethod(Description=" Retrieves IWeb Version *DotNetNuke* |IWEB Core| #IWEB Misc# !Portal! ")]
        [SoapHeader("IWebCredentials")]
    public string GetVersion() {
        string strVersion = "";
        try {

            IWebAuthendication objIWebAuthendication = new IWebAuthendication(IWebCredentials);
            if (!objIWebAuthendication.ValidAndAuthorized())
            {
                return "Not Authorized";
            }

            DesktopModuleController objDesktopModules = new DesktopModuleController();
            ArrayList arr = objDesktopModules.GetDesktopModules();
            foreach (DesktopModuleInfo objDesktopModuleInfo in arr) {
                if ((objDesktopModuleInfo.ModuleName == "IWeb")) 
                {
                    strVersion = objDesktopModuleInfo.Version;
                }
            }
        }
        catch (Exception ex) {
            strVersion = ex.Message;
        }
        return strVersion;
    }

    }

}
